import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, IndexRoute, Redirect, hashHistory } from 'react-router';

// App，处理是否登陆的逻辑；如果已登陆则进入 Dashboard，如果未登陆，则进行有赞授权
import App from './App';

// JWTTokenCallback，服务端获得授权后，进行前端回调，将 token 保存在 local storage
import JWTTokenCallback from './JWTTokenCallback';

// dashboard 主页
import DashboardContainer from './DashboardContainer';

// 店铺未激活页面
import MerchantNotActiveContainer from './MerchantNotActiveContainer';
import './index.css';

ReactDOM.render(
    (<Router history={hashHistory}>
        <Route path="/">
            <IndexRoute component={App} />
            <Route path="dashboard" component={DashboardContainer}/>
            <Route path="callback" component={JWTTokenCallback}/>
            <Route path="merchant/notactive" component={MerchantNotActiveContainer}/>
            <Redirect from="*" to="/" />
        </Route>
    </Router>), document.getElementById('root')
);
